import service from 'utils/axios'
import qs from 'qs'

export function login(params) {
  return service.post('/api/v1/login', qs.stringify(params))
}

export function getStaffs(params) {
  return service.get('/api/v1/staffs', {
    params
  })
}

export function getStores(params) {
  return service.get('/api/v1/stores/', {
    params
  })
}

export function createStaffs(params) {
  return service.post('/api/v1/staffs', params)
}


export function getTrains(params) {
  return service.get('/api/v1/trains', {
    params
  })
}


export function getRegion() {
  return service.get('/api/v1/region')
}


export function getsStaffstTrains(params) {
  return service.get(`/api/v1/staffs/${params.id}/trains/`)
}


export function updateStaffs(params) {
  return service.patch(`/api/v1/staffs/${params.id}/`, params)
}


export function uploadVideo(params) {
  return service.post('/api/v1/resources/', params, {
    'Content-Type': 'application/x-www-form-urlencoded',
  })
}


export function createTrains(params) {
  return service.post('/api/v1/trains/', params)
}


export function updateTrains(params, id) {
  return service.patch(`/api/v1/trains/${id}/`, params)
}


export function createStores(params) {
  return service.post('/api/v1/stores/', params)
}


export function updateStores(params) {
  return service.patch(`/api/v1/stores/${params.id}/`, params)
}

export function exportBtn(params) {
  return service.get(`/api/v1/trains/${params.id}/export/`)
}

export function disable(query) {
  return service.post(`/api/v1/stores/${query.id}/disable/`)
}

export function enable(query) {
  return service.post(`/api/v1/stores/${query.id}/enable/`)
}

export function staffsExport(params) {
  return service.get('/api/v1/staffs/export/', {
    params
  })
}